import requests
from tool.random_number import random_phone

class HttpRunner():

    def send(self,url,method,param=None,data=None,json=None,headers=None):
        method = method.lower()
        if method == 'post':
            result = requests.post(url=url,data=data,json=json,headers=headers)
            return result
        elif method == 'get':
            result = requests.get(url=url,params=param,headers=headers)
            return result
        elif method == 'patch':
            result = requests.patch(url=url,data=data,json=json,headers=headers)
            return result



if __name__ == '__main__':
    url = r'http://api.lemonban.com/futureloan/loans'

    data = {"pageIndex":"qqq","pageSize":10}




    headers = {'X-Lemonban-Media-Type':'lemonban.v2','Authorization':'Bearer eyJhbGciOiJIUzUxMiJ9.eyJtZW1iZXJfaWQiOjg0NjYwLCJleHAiOjE1NzkxMDg2ODV9.8BTDuIL39GY08kFlGBkhWbq1DtkxJ-E1YyQhWTUxXQoFQPlT3Q1-oHisdSpyMhGck14K_8PGrHeF5IeduuEjOw'}


    http = HttpRunner()
    res = http.send(url=url,method='GET',param=data,headers=headers).json()
    print(res)